**********
* Readme *
**********

This collection generates the results, figures, and tables for the paper "When You Can't Afford to Wait for a Job: The Role of Time Discounting for Own-Account Workers in Developing Countries", by Thiago Scarelli and David N. Margolis.


* General folder structure
**************************

replication_package
|_ code
  |_ logs
  |_ project_ado
|_ data
  |_ source_files
    |_ pnad
    |_ pof
|_ results
  |_ estimations
  |_ figures
  |_ tables


"code" includes the computing scripts and auxiliary programs (with optional subfolders for logs and ado files).

"data" stores the datasets generated by the scripts. The raw data files (from the IBGE's repository) are stored in the "source_files" subfolder.

"results" stores the outputs generated by the scripts, divided into "figures", "estimations", and "tables".


* Replication notes and naming conventions
******************************************

The scripts in the "code" folder are meant to be executed in the order they are numbered. A dataset created by a script named "N_script.do" will carry this information in its prefix as "N_dataset.dta". As a general rule, a script N assumes that outputs generated by scripts n < N are available.

Each script includes a brief readme section describing its purpose and its struture.

The set of auxiliary Stata packages (and the sequencial list of do-files) are detailed in the script "0_setup.do". A priori, the packages can be downloaded from their respective sources, but we include a copy of them (the version used in the analysis) in the subfolder code/project_ado.


* Notes on the data sources
****************************

The analysis is based on two large Brazilian surveys. The main data source is the 2017-18 edition of the Household Budget Survey ("Pesquisa de Orçamentos Familiares", or POF), which compiles information on the earnings and expenses of Brazilian households and their members. The second dataset is the National Household Survey ("Pesquisa Nacional por Amostra de Domicílios", or PNAD), a regular labor market survey with a rotating panel structure.

The microdata files and the respective documentation can be downloaded from IBGE's repository. As of July 2024, the files are available at:

- POF: https://ftp.ibge.gov.br/Orcamentos_Familiares/Pesquisa_de_Orcamentos_Familiares_2017_2018/Microdados/
- PNAD: https://ftp.ibge.gov.br/Trabalho_e_Rendimento/Pesquisa_Nacional_por_Amostra_de_Domicilios_continua/Trimestral/Microdados/

Instructions for the download and pre-processing of the raw datasets are provided in the initial scripts (1_1_read_pof_microdata.R and 1_2_read_pnad_microdata.do). For replicability, the original microdata is also included in the subfolder data/source_files.
